import { _decorator, Component, Label, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('CardNumCtrl')
export default class CardNumCtrl extends Component {
    
    @property(Label)
    numLabel: Label = null

    private _num: number = 0

    public init(num: number) {
        this.setNum(num)
    }

    public setNum(num: number) {
        this._num = num
        this.numLabel.string = num.toString()
    }

    /**
     * 减少显示的牌数
     * @param num 
     */
    public subtractNum(num: number) {
        this.setNum(this._num - num)
    }

    /**
     * 增加显示的牌数
     * @param num 
     */
    public increaseNum(num: number) {
        this.setNum(this._num + num)
    }

}


